#include "EpilReturnStatementCode.h"
#include "EpilOutputHelper.h"
#include "TCharSupport.h"
#include "EpilPointerHelper.h"


EpilReturnStatementCode::EpilReturnStatementCode( const EpilLexLocation & location )
: EpilStatementCodeBase( location )
{
}


EpilReturnStatementCode::~EpilReturnStatementCode()
{
	EpilPointerHelper::DeleteItemsAndClear( m_expressions );
}


tstring EpilReturnStatementCode::ToEpilCode( int indent ) const
{
	tstringstream ret;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("return");
	if( m_expressions.empty() )
	{
		return ret.str();
	}
	else
	{
		ret << t(" ");
		ret << EpilOutputHelper::GetListOutput( m_expressions, t(", ") );
	}
	return ret.str();
}